from kuai.sim import setup_model, SimulationJob
from kuai.mol.io import read_molfile
from kuai.sim.dff2kuai import read_ppffile
from kuai.sim.efunc import make_efunc
from kuai.unit import default_units
from numpy import dot
from math import sqrt

mol = read_molfile('Acetone.msd')
index, parameters = read_ppffile('Acetone.ppf')
model = setup_model(mol, index, parameters)

funcs = make_efunc(model, index)
fe = default_units.format(1, 'kcal/mol')
fg = default_units.format(1, 'kcal/mol A')

job = SimulationJob()

e0 = job.getE(model, funcs)
e, g = job.getEG(model, funcs)

print (e0 - e)  * fe[0]
print e * fe[0]
print g * fg[0]

for i in funcs:
    print i.name

print len(funcs[2].lists) / 3
print len(funcs[3].lists) / 5